﻿<Window x:Class="Controls.ListViewSample"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ListViewSample" Height="323" Width="313">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="8*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <ListView Grid.ColumnSpan="3"  Margin="5" ItemsSource="{Binding}">
            <ListView.View>
                <GridView>
                    <!--chekanote: you can neglect writing 'path='-->
                    <!--default template by just using 'DisplayMemberBinding'-->
                    <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"  />
                    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
                    
                    <!--customized template-->
                    <GridViewColumn Header="Qualified">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsQualified}"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Notes">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Notes}" Width="100"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <Button Content="Add" Grid.Column="0" Grid.Row="1" Margin="5" Name="btnAdd"  />
        <Button Content="Remove" Grid.Column="1" Grid.Row="1" Margin="5" Name="btnRemove"  />
        <Button Content="Save" Grid.Column="2" Grid.Row="1" Margin="5" Name="btnSave"  />
    </Grid>
</Window>
